
/*
'===============================================================================
'  Generated From - CSharp_dOOdads_BusinessEntity.vbgen
' 
'  ** IMPORTANT  ** 
'  How to Generate your stored procedures:
' 
'  SQL        = SQL_StoredProcs.vbgen
'  ACCESS     = Access_StoredProcs.vbgen
'  ORACLE     = Oracle_StoredProcs.vbgen
'  FIREBIRD   = FirebirdStoredProcs.vbgen
'  POSTGRESQL = PostgreSQL_StoredProcs.vbgen
'
'  The supporting base class SqlClientEntity is in the Architecture directory in "dOOdads".
'  
'  This object is 'abstract' which means you need to inherit from it to be able
'  to instantiate it.  This is very easilly done. You can override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  public class YourObject :  _YourObject
'  {
'
'  }
'
'===============================================================================
*/

// Generated by MyGeneration Version # (1.3.0.3)

using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using System.Collections.Specialized;

using MyGeneration.dOOdads;

namespace DAL
{
	public abstract class _PageContent : SqlClientEntity
	{
		public _PageContent()
		{
			this.QuerySource = "PageContent";
			this.MappingName = "PageContent";

		}	

		//=================================================================
		//  public Overrides void AddNew()
		//=================================================================
		//
		//=================================================================
		public override void AddNew()
		{
			base.AddNew();
			
		}
		
		
		public override void FlushData()
		{
			this._whereClause = null;
			this._aggregateClause = null;
			base.FlushData();
		}
		
		//=================================================================
		//  	public Function LoadAll() As Boolean
		//=================================================================
		//  Loads all of the records in the database, and sets the currentRow to the first row
		//=================================================================
		public bool LoadAll() 
		{
			ListDictionary parameters = null;
			
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_PageContentLoadAll]", parameters);
		}
	
		//=================================================================
		// public Overridable Function LoadByPrimaryKey()  As Boolean
		//=================================================================
		//  Loads a single row of via the primary key
		//=================================================================
		public virtual bool LoadByPrimaryKey(int PageID)
		{
			ListDictionary parameters = new ListDictionary();
			parameters.Add(Parameters.PageID, PageID);

		
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_PageContentLoadByPrimaryKey]", parameters);
		}
		
		#region Parameters
		protected class Parameters
		{
			
			public static SqlParameter PageID
			{
				get
				{
					return new SqlParameter("@PageID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter PageTitle
			{
				get
				{
					return new SqlParameter("@PageTitle", SqlDbType.NVarChar, 500);
				}
			}
			
			public static SqlParameter PlaceHolder1
			{
				get
				{
					return new SqlParameter("@PlaceHolder1", SqlDbType.NVarChar, 500);
				}
			}
			
			public static SqlParameter PlaceHolder2
			{
				get
				{
					return new SqlParameter("@PlaceHolder2", SqlDbType.NVarChar, 500);
				}
			}
			
			public static SqlParameter PlaceHolder3
			{
				get
				{
					return new SqlParameter("@PlaceHolder3", SqlDbType.NVarChar, 500);
				}
			}
			
		}
		#endregion		
	
		#region ColumnNames
		public class ColumnNames
		{  
            public const string PageID = "PageID";
            public const string PageTitle = "PageTitle";
            public const string PlaceHolder1 = "PlaceHolder1";
            public const string PlaceHolder2 = "PlaceHolder2";
            public const string PlaceHolder3 = "PlaceHolder3";

			static public string ToPropertyName(string columnName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[PageID] = _PageContent.PropertyNames.PageID;
					ht[PageTitle] = _PageContent.PropertyNames.PageTitle;
					ht[PlaceHolder1] = _PageContent.PropertyNames.PlaceHolder1;
					ht[PlaceHolder2] = _PageContent.PropertyNames.PlaceHolder2;
					ht[PlaceHolder3] = _PageContent.PropertyNames.PlaceHolder3;

				}
				return (string)ht[columnName];
			}

			static private Hashtable ht = null;			 
		}
		#endregion
		
		#region PropertyNames
		public class PropertyNames
		{  
            public const string PageID = "PageID";
            public const string PageTitle = "PageTitle";
            public const string PlaceHolder1 = "PlaceHolder1";
            public const string PlaceHolder2 = "PlaceHolder2";
            public const string PlaceHolder3 = "PlaceHolder3";

			static public string ToColumnName(string propertyName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[PageID] = _PageContent.ColumnNames.PageID;
					ht[PageTitle] = _PageContent.ColumnNames.PageTitle;
					ht[PlaceHolder1] = _PageContent.ColumnNames.PlaceHolder1;
					ht[PlaceHolder2] = _PageContent.ColumnNames.PlaceHolder2;
					ht[PlaceHolder3] = _PageContent.ColumnNames.PlaceHolder3;

				}
				return (string)ht[propertyName];
			}

			static private Hashtable ht = null;			 
		}			 
		#endregion	

		#region StringPropertyNames
		public class StringPropertyNames
		{  
            public const string PageID = "s_PageID";
            public const string PageTitle = "s_PageTitle";
            public const string PlaceHolder1 = "s_PlaceHolder1";
            public const string PlaceHolder2 = "s_PlaceHolder2";
            public const string PlaceHolder3 = "s_PlaceHolder3";

		}
		#endregion		
		
		#region Properties
	
		public virtual int PageID
	    {
			get
	        {
				return base.Getint(ColumnNames.PageID);
			}
			set
	        {
				base.Setint(ColumnNames.PageID, value);
			}
		}

		public virtual string PageTitle
	    {
			get
	        {
				return base.Getstring(ColumnNames.PageTitle);
			}
			set
	        {
				base.Setstring(ColumnNames.PageTitle, value);
			}
		}

		public virtual string PlaceHolder1
	    {
			get
	        {
				return base.Getstring(ColumnNames.PlaceHolder1);
			}
			set
	        {
				base.Setstring(ColumnNames.PlaceHolder1, value);
			}
		}

		public virtual string PlaceHolder2
	    {
			get
	        {
				return base.Getstring(ColumnNames.PlaceHolder2);
			}
			set
	        {
				base.Setstring(ColumnNames.PlaceHolder2, value);
			}
		}

		public virtual string PlaceHolder3
	    {
			get
	        {
				return base.Getstring(ColumnNames.PlaceHolder3);
			}
			set
	        {
				base.Setstring(ColumnNames.PlaceHolder3, value);
			}
		}


		#endregion
		
		#region String Properties
	
		public virtual string s_PageID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.PageID) ? string.Empty : base.GetintAsString(ColumnNames.PageID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.PageID);
				else
					this.PageID = base.SetintAsString(ColumnNames.PageID, value);
			}
		}

		public virtual string s_PageTitle
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.PageTitle) ? string.Empty : base.GetstringAsString(ColumnNames.PageTitle);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.PageTitle);
				else
					this.PageTitle = base.SetstringAsString(ColumnNames.PageTitle, value);
			}
		}

		public virtual string s_PlaceHolder1
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.PlaceHolder1) ? string.Empty : base.GetstringAsString(ColumnNames.PlaceHolder1);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.PlaceHolder1);
				else
					this.PlaceHolder1 = base.SetstringAsString(ColumnNames.PlaceHolder1, value);
			}
		}

		public virtual string s_PlaceHolder2
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.PlaceHolder2) ? string.Empty : base.GetstringAsString(ColumnNames.PlaceHolder2);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.PlaceHolder2);
				else
					this.PlaceHolder2 = base.SetstringAsString(ColumnNames.PlaceHolder2, value);
			}
		}

		public virtual string s_PlaceHolder3
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.PlaceHolder3) ? string.Empty : base.GetstringAsString(ColumnNames.PlaceHolder3);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.PlaceHolder3);
				else
					this.PlaceHolder3 = base.SetstringAsString(ColumnNames.PlaceHolder3, value);
			}
		}


		#endregion		
	
		#region Where Clause
		public class WhereClause
		{
			public WhereClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffWhereParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffWhereParameter(this);
					}

					return _tearOff;
				}
			}

			#region WhereParameter TearOff's
			public class TearOffWhereParameter
			{
				public TearOffWhereParameter(WhereClause clause)
				{
					this._clause = clause;
				}
				
				
				public WhereParameter PageID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.PageID, Parameters.PageID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter PageTitle
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.PageTitle, Parameters.PageTitle);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter PlaceHolder1
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.PlaceHolder1, Parameters.PlaceHolder1);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter PlaceHolder2
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.PlaceHolder2, Parameters.PlaceHolder2);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter PlaceHolder3
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.PlaceHolder3, Parameters.PlaceHolder3);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}


				private WhereClause _clause;
			}
			#endregion
		
			public WhereParameter PageID
		    {
				get
		        {
					if(_PageID_W == null)
	        	    {
						_PageID_W = TearOff.PageID;
					}
					return _PageID_W;
				}
			}

			public WhereParameter PageTitle
		    {
				get
		        {
					if(_PageTitle_W == null)
	        	    {
						_PageTitle_W = TearOff.PageTitle;
					}
					return _PageTitle_W;
				}
			}

			public WhereParameter PlaceHolder1
		    {
				get
		        {
					if(_PlaceHolder1_W == null)
	        	    {
						_PlaceHolder1_W = TearOff.PlaceHolder1;
					}
					return _PlaceHolder1_W;
				}
			}

			public WhereParameter PlaceHolder2
		    {
				get
		        {
					if(_PlaceHolder2_W == null)
	        	    {
						_PlaceHolder2_W = TearOff.PlaceHolder2;
					}
					return _PlaceHolder2_W;
				}
			}

			public WhereParameter PlaceHolder3
		    {
				get
		        {
					if(_PlaceHolder3_W == null)
	        	    {
						_PlaceHolder3_W = TearOff.PlaceHolder3;
					}
					return _PlaceHolder3_W;
				}
			}

			private WhereParameter _PageID_W = null;
			private WhereParameter _PageTitle_W = null;
			private WhereParameter _PlaceHolder1_W = null;
			private WhereParameter _PlaceHolder2_W = null;
			private WhereParameter _PlaceHolder3_W = null;

			public void WhereClauseReset()
			{
				_PageID_W = null;
				_PageTitle_W = null;
				_PlaceHolder1_W = null;
				_PlaceHolder2_W = null;
				_PlaceHolder3_W = null;

				this._entity.Query.FlushWhereParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffWhereParameter _tearOff;
			
		}
	
		public WhereClause Where
		{
			get
			{
				if(_whereClause == null)
				{
					_whereClause = new WhereClause(this);
				}
		
				return _whereClause;
			}
		}
		
		private WhereClause _whereClause = null;	
		#endregion
	
		#region Aggregate Clause
		public class AggregateClause
		{
			public AggregateClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffAggregateParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffAggregateParameter(this);
					}

					return _tearOff;
				}
			}

			#region AggregateParameter TearOff's
			public class TearOffAggregateParameter
			{
				public TearOffAggregateParameter(AggregateClause clause)
				{
					this._clause = clause;
				}
				
				
				public AggregateParameter PageID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.PageID, Parameters.PageID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter PageTitle
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.PageTitle, Parameters.PageTitle);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter PlaceHolder1
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.PlaceHolder1, Parameters.PlaceHolder1);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter PlaceHolder2
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.PlaceHolder2, Parameters.PlaceHolder2);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter PlaceHolder3
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.PlaceHolder3, Parameters.PlaceHolder3);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}


				private AggregateClause _clause;
			}
			#endregion
		
			public AggregateParameter PageID
		    {
				get
		        {
					if(_PageID_W == null)
	        	    {
						_PageID_W = TearOff.PageID;
					}
					return _PageID_W;
				}
			}

			public AggregateParameter PageTitle
		    {
				get
		        {
					if(_PageTitle_W == null)
	        	    {
						_PageTitle_W = TearOff.PageTitle;
					}
					return _PageTitle_W;
				}
			}

			public AggregateParameter PlaceHolder1
		    {
				get
		        {
					if(_PlaceHolder1_W == null)
	        	    {
						_PlaceHolder1_W = TearOff.PlaceHolder1;
					}
					return _PlaceHolder1_W;
				}
			}

			public AggregateParameter PlaceHolder2
		    {
				get
		        {
					if(_PlaceHolder2_W == null)
	        	    {
						_PlaceHolder2_W = TearOff.PlaceHolder2;
					}
					return _PlaceHolder2_W;
				}
			}

			public AggregateParameter PlaceHolder3
		    {
				get
		        {
					if(_PlaceHolder3_W == null)
	        	    {
						_PlaceHolder3_W = TearOff.PlaceHolder3;
					}
					return _PlaceHolder3_W;
				}
			}

			private AggregateParameter _PageID_W = null;
			private AggregateParameter _PageTitle_W = null;
			private AggregateParameter _PlaceHolder1_W = null;
			private AggregateParameter _PlaceHolder2_W = null;
			private AggregateParameter _PlaceHolder3_W = null;

			public void AggregateClauseReset()
			{
				_PageID_W = null;
				_PageTitle_W = null;
				_PlaceHolder1_W = null;
				_PlaceHolder2_W = null;
				_PlaceHolder3_W = null;

				this._entity.Query.FlushAggregateParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffAggregateParameter _tearOff;
			
		}
	
		public AggregateClause Aggregate
		{
			get
			{
				if(_aggregateClause == null)
				{
					_aggregateClause = new AggregateClause(this);
				}
		
				return _aggregateClause;
			}
		}
		
		private AggregateClause _aggregateClause = null;	
		#endregion
	
		protected override IDbCommand GetInsertCommand() 
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_PageContentInsert]";
	
			CreateParameters(cmd);
			
			SqlParameter p;
			p = cmd.Parameters[Parameters.PageID.ParameterName];
			p.Direction = ParameterDirection.Output;
    
			return cmd;
		}
	
		protected override IDbCommand GetUpdateCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_PageContentUpdate]";
	
			CreateParameters(cmd);
			      
			return cmd;
		}
	
		protected override IDbCommand GetDeleteCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_PageContentDelete]";
	
			SqlParameter p;
			p = cmd.Parameters.Add(Parameters.PageID);
			p.SourceColumn = ColumnNames.PageID;
			p.SourceVersion = DataRowVersion.Current;

  
			return cmd;
		}
		
		private IDbCommand CreateParameters(SqlCommand cmd)
		{
			SqlParameter p;
		
			p = cmd.Parameters.Add(Parameters.PageID);
			p.SourceColumn = ColumnNames.PageID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.PageTitle);
			p.SourceColumn = ColumnNames.PageTitle;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.PlaceHolder1);
			p.SourceColumn = ColumnNames.PlaceHolder1;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.PlaceHolder2);
			p.SourceColumn = ColumnNames.PlaceHolder2;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.PlaceHolder3);
			p.SourceColumn = ColumnNames.PlaceHolder3;
			p.SourceVersion = DataRowVersion.Current;


			return cmd;
		}
	}
}
